/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dtd.to.xml;

import java.util.List;
import java.util.Objects;

/**
 *
 * @author Mato Majdis
 */
public class XMLSchema {
    private String head;
    private List<String> elements;
    
    public String getHead() {
        return head;
    }
    
    public void setHead(String head) {
        this.head = head;
    }
    
    public List<String> getElements() {
        return elements;
    }
    
    public void setElements(List<String> elements) {
        this.elements = elements;
    }
    
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + Objects.hashCode(this.head);
        hash = 29 * hash + Objects.hashCode(this.elements);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final XMLSchema other = (XMLSchema) obj;
        if (!Objects.equals(this.head, other.head)) {
            return false;
        }
        if (!Objects.equals(this.elements, other.elements)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        String schema = head;
        schema += "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">";    
        schema += System.lineSeparator() + System.lineSeparator();
        for(String element : elements) {
            schema += element;
        }
        schema += "</xs:schema>";
        
        return schema;
    }
    
}
